<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>09-DOM内容节点操作</title>
    <script>
        window.onload=function () {
            // 获取 p标签和 button id="txt-btn"
            let pEle = document.getElementById("txt");
            let txtBtnEle = document.getElementById("txt-btn");
            // 给 txtBtnEle 绑定事件
            txtBtnEle.onclick=function (){
                pEle.innerText="p标签添加文本内容";
            }
            let divEle = document.getElementById("box");
            let boxBtnEle = document.getElementById("box-btn");
            boxBtnEle.onclick=function () {
                divEle.innerHTML="<h1>div添加内容</h1>"
            }
        }
    </script>
</head>
<body>
<p id="txt"></p>
<div id="box"></div>
<button id="txt-btn">给p标签添加文本内容</button>
<button id="box-btn">给div标签添加标签</button>
</body>
</html>